package com.hbt.word_provider.dao;

import com.hbt.api.entity.Word;
import com.hbt.api.entity.WordsCondition;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WordMapper {
    @Delete("delete from word where id = #{wordid}")
    public int delWordByWordid(int wordid);

    @Select("select *from word where userid = #{param1} and src = #{param2}")
    public Word getWordByuserIdAndSrc(int userid, String src);

    @Select("select count(*) from word where cmd = #{param2} and userid = #{param1}")
    public int getCmdCountByUserIdAndCmdStr(int userid, String cmd_str);
    @Select("select count(*) from word where imp = #{param2} and userid = #{param1}")
    public int getImpCountByUserIdAndImpStr(int userid, String imp_str);


    @Select("select count(*) from word where cmd = '很熟练' and userid = #{userid}")
    public int getHenCmdCountByUserId(int userid);

    @Select("select count(*) from word where cmd = '熟练' and userid = #{userid}")
    public int getCmdCountByUserId(int userid);

    @Select("select count(*) from word where cmd = '不熟练' and userid = #{userid}")
    public int getNoCmdCountByUserId(int userid);

    @Select("select count(*) from word where imp = '很重要' and userid = #{userid}")
    public int getHenImpCountByUserID(int userid);

    @Select("select count(*) from word where imp = '重要' and userid = #{userid}")
    public int getImpCountByUserID(int userid);

    @Select("select count(*) from word where imp = '不重要' and userid = #{userid}")
    public int getNoImpCountByUserID(int userid);


    public int insertWord(Word word);

    public List<Word> getWordsByCondition(WordsCondition wordsCondition);

    public Word getWordByWordId(int wordid);

    @Select("select count(*) from word where userid = #{userid}")
    public int getTotalCountByUserId(int userid);

    public int updateWord(Word word);
}
